#include "problems/21.h"
#include "gtest/gtest.h"
#include <vector>

using namespace std;

TEST(TestProblemSolutions, TestProblem21)
{
    problem_21::Solution s;
    ListNode n1(1), n2(2), n3(4), n4(1), n5(3), n6(4);
    n1.next = &n2;
    n2.next = &n3;
    n4.next = &n5;
    n5.next = &n6;
    auto result = s.mergeTwoLists(&n1, &n4);
    vector<int> ans{1, 1, 2, 3, 4, 4};
    for (auto n : ans)
    {
        ASSERT_NE(result, nullptr);
        ASSERT_EQ(result->val, n);
        result = result->next;
    }
}